home *** CD-ROM | disk | FTP | other *** search
- /*
- * $RCSfile: 2PC.c,v $
- * $Revision: 1.1.1.1 $
- * $Date: 1996/05/04 21:55:30 $
- */
- /**********************************************************************
- * EXODUS Database Toolkit Software
- * Copyright (c) 1991 Computer Sciences Department, University of
- * Wisconsin -- Madison
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
- * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.
- * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
- * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * The EXODUS Project Group requests users of this software to return
- * any improvements or extensions that they make to:
- *
- * EXODUS Project Group
- * c/o David J. DeWitt and Michael J. Carey
- * Computer Sciences Department
- * University of Wisconsin -- Madison
- * Madison, WI 53706
- *
- * or exodus@cs.wisc.edu
- *
- * In addition, the EXODUS Project Group requests that users grant the
- * Computer Sciences Department rights to redistribute these changes.
- **********************************************************************/
-
- #include "sysdefs.h"
- #include "ess.h"
- #include "checking.h"
- #include "trace.h"
- #include "error.h"
- #include "list.h"
- #include "pool.h"
- #include "tid.h"
- #include "io.h"
- #include "lock.h"
- #include "object.h"
- #include "msgdefs.h"
- #include "trans.h"
- #include "bf.h"
- #include "chunk.h"
- #include "serverinfo.h"
- #include "bf_extfuncs.h"
- #include "trans_funcs.h"
- #include "msg_funcs.h"
- #include "trans_globals.h"
- #include "msg_globals.h"
-
-
- int
- continue2PC (
-
- TRANSREC *transRec
- )
- {
- MESSAGE message;
-
- TRACE(TR_TRANS, TR_LEVEL_1);
-
- message.header.params.in.tid = transRec->coordTid;
- message.header.type = CONTINUE_2PC;
- message.header.replyRequested = TRUE;
-
- /*
- * request a transaction id from the server
- */
- if (callServer(transRec->coordInfo, &message, NULL, 0 ) != esmNOERROR) {
-
- if (message.header.params.out.errno == esmBADTRANSID)
- endTransForAllServers(transRec, ABORT_TRANS);
-
- return(esmFAILURE);
- }
-
- return(esmNOERROR);
- }
-
- int
- enter2PC (
-
- SERVERINFO *serverInfo,
- TID *coordTid,
- GTID *gtid
- )
- {
- MESSAGE message;
-
- /*
- * have to go to the coord to get a coord-tid, which
- * serves as the GLOBAL-TID-THREAD-ID
- * so that we can distinguish this thread of a GTX from
- * another exodus thread of the same GTX
- */
-
- TRACE(TR_TRANS, TR_LEVEL_1);
-
- message.header.type = ENTER2PC;
- message.header.replyRequested = TRUE;
-
-
- /*
- * request a transaction id from the server
- */
- if (callServer(serverInfo, &message, (char *)gtid, sizeof(GTID) ) != esmNOERROR) {
-
- return(esmFAILURE);
- }
-
- if(coordTid != NULL)
- *coordTid = message.body.trans.tid;
- TRPRINT(TR_TRANS, TR_LEVEL_2, ("coordTid:%d", coordTid?*coordTid:0));
-
- return(esmNOERROR);
- }
-
- int
- recover2PC (
-
- COORD_HANDLE *handle,
- SERVERINFO *coordInfo
- )
- {
- MESSAGE message;
-
- TRACE(TR_TRANS, TR_LEVEL_1);
-
- message.header.params.in.tid = handle->coordTid;
- message.header.type = RECOVER_2PC;
- message.header.replyRequested = TRUE;
-
- /*
- * request a transaction id from the server
- */
- if (callServer(coordInfo, &message, NULL, 0 ) != esmNOERROR) {
-
- return(esmFAILURE);
- }
-
- TRPRINT(TR_DISTR|TR_TRANS, TR_LEVEL_2, ("recovered coordTid:%d", handle->coordTid));
-
- return(esmNOERROR);
- }
-